<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/js/jquery.timers.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	start = 0;
	end =50;
	total = 0;
	$("#start").click(function() {
		 $.ajax({
			   url: "/category/parse/", 
			   success: function(msg){
			   alert(msg);
				 $("#message").everyTime(1000, 'timer2', function(i) {
					 $.ajax({
						   url: "/product/parse/start/" + (start+1) + "/end/"+end,
						   success: function(msg){
						      if(parseInt(msg)==0){
							      $('#message').stopTime('timer2');
						      }
						      
						      total =total + parseInt(msg);
						     $("#message").html('Добавленно товаров :' + total );
						   }
						 });
					 start+=50;
					 end+=50;
				 }, 500000);
		   }
		 });
	});
});
</script> 
<input type="button"  value="start" id="start">
<div id="message"></div>
